<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <?php include('public/head.php');?>
</head>
<body>
<?php include('public/header.php');?>

<div class="container">
    <?php include('public/process.php');?>
    <div class="panel panel-default">
        <div class="panel-body">
            <h4><?php echo lang('setting_database_info');?></h4>
            <?php if(!empty($has_errors)):?>
            <div class="alert alert-danger" role="alert">
                <?php echo validation_errors();?>
            </div>
            <?php endif;?>
                <?php
                echo form_open('setup/installing',array(
                   'id'=>'form-install',
                    'class'=>'form-horizontal'
                ));?>
                <div class="form-group">
                    <label for="db-driver" class="col-sm-2 control-label"><?php echo lang('database_driver');?></label>
                    <div class="col-sm-2"  data-toggle="tooltip" data-placement="right" title="数据库连接类型，服务器支持的情况下建议使用mysqli">
                        <select class="form-control" id="db-driver" name="db[driver]">
                            <option <?php echo  set_select('db[driver]', 'mysqli', TRUE); ?>>mysqli</option>
                            <option <?php echo  set_select('db[driver]', 'mysql'); ?>>mysql</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="db-host" class="col-sm-2 control-label"><?php echo lang('database_server');?></label>
                    <div class="col-sm-2"  data-toggle="tooltip" data-placement="right" title="数据库服务器，数据库服务器IP，一般为127.0.0.1">
                        <input type="text" class="form-control" id="db-host" name="db[host]" value="<?php echo set_value('db[host]','127.0.0.1');?>" placeholder="127.0.0.1">
                    </div>
                </div>
                <div class="form-group">
                    <label for="db-port" class="col-sm-2 control-label"><?php echo lang('database_port');?></label>
                    <div class="col-sm-2" data-toggle="tooltip" data-placement="right" title="数据库端口，数据库服务连接端口，一般为3306">
                        <input type="text" class="form-control" id="db-port" name="db[port]" value="<?php echo set_value('db[port]','3306');?>" placeholder="3306">
                    </div>
                </div>
                <div class="form-group">
                    <label for="db-name" class="col-sm-2 control-label"><?php echo lang('database_name');?></label>
                    <div class="col-sm-2" data-toggle="tooltip" data-placement="right" title="系统数据库名称">
                        <input type="text" class="form-control" id="db-name" name="db[name]" value="<?php echo set_value('db[name]','ci');?>" placeholder="ci">
                    </div>
                </div>
                <div class="form-group">
                    <label for="db-user" class="col-sm-2 control-label"><?php echo lang('database_user');?></label>
                    <div class="col-sm-2" data-toggle="tooltip" data-placement="right" title="数据库授权账号">
                        <input type="text" class="form-control" id="db-user" name="db[user]" value="<?php echo set_value('db[user]','root');?>" placeholder="root">
                    </div>
                </div>
                <div class="form-group">
                    <label for="db-password" class="col-sm-2 control-label"><?php echo lang('database_password');?></label>
                    <div class="col-sm-2" data-toggle="tooltip" data-placement="right" title="数据库授权密码">
                        <input type="text" class="form-control" id="db-password" name="db[password]" value="<?php echo set_value('db[password]');?>" placeholder="******">
                    </div>
                </div>
                <div class="form-group">
                    <label for="db-prefix" class="col-sm-2 control-label"><?php echo lang('database_table_prefix');?></label>
                    <div class="col-sm-2" data-toggle="tooltip" data-placement="right" title="数据库表名前缀：ci_user.">
                        <input type="text" class="form-control" id="db-prefix" name="db[prefix]" value="<?php echo set_value('db[prefix]','ci_');?>">
                    </div>
                </div>
                <h4><?php echo lang('setting_creator_info');?></h4>

                <div class="form-group">
                    <label for="admin-name" class="col-sm-2 control-label"><?php echo lang('admin_user');?></label>
                    <div class="col-sm-2" data-toggle="tooltip" data-placement="right" title="后台管理登录账号">
                        <input type="text" class="form-control" id="db-prefix" name="admin[user]" value="<?php echo set_value('admin[user]','admin');?>" >
                    </div>
                </div>

                <div class="form-group">
                    <label for="admin-password" class="col-sm-2 control-label"><?php echo lang('admin_password');?></label>
                    <div class="col-sm-2"data-toggle="tooltip" data-placement="right" title="管理员密码">
                        <input type="text" class="form-control" id="db-prefix" name="admin[password]" value="<?php echo set_value('admin[password]','admin');?>"  placeholder="password">
                    </div>
                </div>

                <div class="form-group">
                    <label for="admin-repassword" class="col-sm-2 control-label"><?php echo lang('confirm_password');?></label>
                    <div class="col-sm-2"data-toggle="tooltip" data-placement="right" title="确认管理员密码">
                        <input type="text" class="form-control" id="db-prefix" name="admin[repassword]" value="<?php echo set_value('admin[repassword]','admin');?>"  placeholder="repassword">
                    </div>
                </div>

                <div class="form-group">
                    <label for="admin-email" class="col-sm-2 control-label"><?php echo lang('admin_email');?></label>
                    <div class="col-sm-2" data-toggle="tooltip" data-placement="right" title="邮箱，请填写正确的邮箱便于收取提醒邮件">
                        <input type="email" class="form-control" id="admin-email" name="admin[email]" value="<?php echo set_value('admin[email]','dungang@126.com');?>"  placeholder="admin@master.com">
                    </div>
                </div>
            </form>
        </div>
    </div>
    <nav>
        <ul class="pager">
            <li><a href="<?php echo site_url('setup/environment')?>" ><?php echo lang('previous');?></a></li>
            <li><a id="install-click" href="#" ><?php echo lang('install');?></a></li>
        </ul>
    </nav>
    <!-- /.container -->
    <?php include('public/footer.php');?>

    <script>
        $(function () {
            $('#install-click').on('click', function () {
                $('#form-install').submit();
            })
            $('[data-toggle="tooltip"]').tooltip();

            var list   = $('#show-list');
            function show_msg(msg, classname){
                var li = document.createElement('p');
                li.innerHTML = msg;
                classname && li.setAttribute('class', classname);
                list.appendChild(li);
                document.scrollTop += 30;
            }
        })
    </script>
</body>
</html>